package com.yuexunit.operationman.nbsy.module.OperationBeforeAndAfter.ui.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;


import com.yuexunit.operationman.nbsy.R;
import com.yuexunit.operationman.nbsy.config.AppConfig;

import org.kymjs.kjframe.ui.KJFragment;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by chenss on 2017/11/14 0014.
 */

public class Frag_Operation_AfterVisit extends KJFragment {
    @Bind(R.id.bv_01)
    TextView bv01;
    @Bind(R.id.bv_02)
    TextView bv02;
    @Bind(R.id.bv_03)
    TextView bv03;
    @Bind(R.id.bv_04)
    TextView bv04;
    @Bind(R.id.bv_05)
    TextView bv05;
    @Bind(R.id.bv_06)
    TextView bv06;
    @Bind(R.id.bv_07)
    TextView bv07;
    @Bind(R.id.bv_08)
    TextView bv08;
    @Bind(R.id.bv_09)
    TextView bv09;
    @Bind(R.id.bv_10)
    TextView bv10;
    @Bind(R.id.bv_11)
    TextView bv11;

    protected View mMainView;

    @Override
    protected View inflaterView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
        mMainView = inflater.inflate(R.layout.frag_operation_aftervisit, container, false);
        ButterKnife.bind(this, mMainView);
        return mMainView;
    }

    @Override
    protected void initData() {
        bv01.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getOperationName());
        bv02.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getPostoperative());
        bv03.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getPostoperativeDiagnosis());
        bv04.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getTemperature());
        if(AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getPain().equals("0"))
        {
            bv05.setText("轻");
        }
        if(AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getPain().equals("1"))
        {
            bv05.setText("中");
        }
        if(AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getPain().equals("2"))
        {
            bv05.setText("重");
        }
        if(AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getWound().length()>0) {
            String[] arrays = AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getWound().split(";", -1);
            String[] arrayNames = getResources().getStringArray(R.array.beforeandafter_03);
            String content = "";
            if(arrays[0].equals("1"))
            {
                content+=arrayNames[0];
            }
            if(arrays[1].equals("1"))
            {
                if (content.length() > 0) {
                    content += "\n";
                    content += arrayNames[1];
                }
                else {
                    content += arrayNames[1];
                }
            }
            if(arrays[2].equals("1"))
            {
                if (content.length() > 0) {
                    content += "\n";
                    content += arrayNames[2];
                }
                else {
                    content += arrayNames[2];
                }
            }
            if(arrays[3].equals("1"))
            {
                if (content.length() > 0) {
                    content += "\n";
                    content += arrayNames[3];
                }
                else {
                    content += arrayNames[3];
                }
            }
            bv06.setText(content);
        }
        if(AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getRecure().length()>0) {
            String[] arrays = AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getRecure().split(";", -1);
            String[] arrayNames = getResources().getStringArray(R.array.beforeandafter_04);
            String content = "";
            if(arrays[0].equals("1"))
            {
                content+=arrayNames[0];
            }
            if(arrays[1].equals("1"))
            {
                if (content.length() > 0) {
                    content += "\n";
                    content += arrayNames[1];
                }
                else {
                    content += arrayNames[1];
                }
            }
            if(arrays[2].equals("1"))
            {
                if (content.length() > 0) {
                    content += "\n";
                    content += arrayNames[2];
                }
                else {
                    content += arrayNames[2];
                }
            }
            bv07.setText(content);
        }
        if(AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getCareForYou().equals("0"))
        {
            bv08.setText("是");
        }
        if(AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getCareForYou().equals("1"))
        {
            bv08.setText("否");
        }
        if(AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getHelpYou().equals("0"))
        {
            bv09.setText("是");
        }
        if(AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getHelpYou().equals("1"))
        {
            bv09.setText("否");
        }
        if(AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getAttitude().equals("0"))
        {
            bv10.setText("满意");
        }
        if(AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getAttitude().equals("1"))
        {
            bv10.setText("基本满意");
        }
        if(AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getAttitude().equals("2"))
        {
            bv10.setText("不满意");
        }
        bv11.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getAfterNursing().getSuggestion());
    }
}
